<template>
	<view>
		<view class="mycollect">


			<view class="car-list">
				<block v-if="list.length>0">
					<view class="tab-list-li" v-for="(item,index) in list" :key="index">
						<navigator :url="`/pages/carInfo/carInfo?item=${encodeURIComponent(JSON.stringify(item))}`"
							hover-class="none">
							<tab-item :item="item"></tab-item>
						</navigator>
					</view>

				</block>
				<view v-else>
					<null></null>
				</view>
			</view>

		</view>

		<u-loadmore :status="status" :load-text="loadText" />
	</view>
</template>
<script>
	import API from "@/api/my.js"
	export default {
		name: "myCollect",
		created() {
			this.getCollect();
		},
		onLoad() {

		},
		onReachBottom() {
			uni.showLoading({
				title: this.status,
			});
			this.status = 'loading';
			this.getInfo.page = this.getInfo.page + 1;
			this.getCollect();
		},
		data() {
			return {
				loadText: {
					loadmore: '轻轻上拉',
					loading: '努力加载中',
					nomore: '实在没有了'
				},
				count: 0,
				https: getApp().globalData.picturePath,
				status: 'loadmore',
				list: [],

				getInfo: {
					page: 1,
					limit: 10,
				}
			};
		},
		methods: {
			getCollect() {
				API.getCollect(this.getInfo).then(res => {
					console.log(res.data);
					// res.data.map(ele=>ele.carRegistrationTime.substring(0,7))
					this.list = res.data;
					this.list.forEach(v=>{
						v.carRegistrationTime.substring(0,7)
					})
				})
			},
		}
	};
</script>
<style scoped lang="scss">
	.mycollect {
		padding: 0rpx $uni-widthspace;
		margin: $uni-widthspace;
		box-sizing: border-box;
		border-radius: 10rpx;
		background-color: #fff;

		.car-list {
			.tab-list-li {
				border-bottom: 2rpx solid #eee;
				padding: 20rpx 0rpx;
				box-sizing: border-box;
			}
		}
	}
</style>
